package com.chlitina.store.modules.cash.model;

public class ProductPayment {
	private AllCardPaymentDetail allCardPaymentDetail;
	private ProductCardPaymentDetail productCardPaymentDetail;
	private float cash;
	private String description;

	public void updateDescription() {
		if (allCardPaymentDetail != null) {
			AllCardPayment cardPayment = allCardPaymentDetail.getCardPayment();
			description = "耗卡：【"
					+ allCardPaymentDetail.getCardPayment().getCard()
							.getTemplate().getName() + "】(综合卡"+cardPayment.getCard().getCardNumber()+"), "
					+ allCardPaymentDetail.getRealCost() + " 元"+"----剩余-- "+allCardPaymentDetail.getCardPayment().getCurrentMoney();
		} else if (productCardPaymentDetail != null) {
			ProductCardPayment cardPayment = productCardPaymentDetail.getCardPayment();
			description = "耗卡：【"
					+ cardPayment.getCard()
							.getTemplate().getName() + "】(产品卡"+productCardPaymentDetail.getCardPayment().getCard().getCardNumber()+"), "
					+ productCardPaymentDetail.getRealCost() + " 元"+"----剩余-- "+productCardPaymentDetail.getCardPayment().getCurrentMoney();
		} else if (cash > 0) {
			description = "现金：付现 " + cash + " 元";
		}
	}
	
	public float getRealTotalCost() {
		if (allCardPaymentDetail != null) {
			return allCardPaymentDetail.getRealCost();
		} else if (productCardPaymentDetail != null) {
			return productCardPaymentDetail.getRealCost();
		} else if (cash > 0) {
			 return cash;
		}
		return 0F;
	}
	
	
	
	public float getCash() {
		return cash;
	}

	public void setCash(float cash) {
		this.cash = cash;
	}

	public AllCardPaymentDetail getAllCardPaymentDetail() {
		return allCardPaymentDetail;
	}

	public void setAllCardPaymentDetail(
			AllCardPaymentDetail allCardPaymentDetail) {
		this.allCardPaymentDetail = allCardPaymentDetail;
	}

	public ProductCardPaymentDetail getProductCardPaymentDetail() {
		return productCardPaymentDetail;
	}

	public void setProductCardPaymentDetail(
			ProductCardPaymentDetail productCardPaymentDetail) {
		this.productCardPaymentDetail = productCardPaymentDetail;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
}
